UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vDhjAhSgBpNwoeYR5/5xhyjXwH5kNJoUjL2t3IWAkkk=' 
WHERE 
  key_id = '16b9b29c7ce2373d927339e7d198508cb7bf04aef62d3a749bee957f4b39aa41' 
  AND (
    token = 'vDhjAhSgBpNwoeYR5/5xhyjXwH5kNJoUjL2t3IWAkkk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025