UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pd6qhFiX69LVtWXOpWVM7LyNKKA0+AVEfZviyGqaZ+s=' 
WHERE 
  key_id = '571f30153c2a144b25919e90c5a684fe5446b235e17c6245fa35c3b1037efb5d' 
  AND (
    token = 'Pd6qhFiX69LVtWXOpWVM7LyNKKA0+AVEfZviyGqaZ+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030