UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7sVkJMi+9YsvZAAwt38qPjMH65tWSeOhHt95frnw2CE=' 
WHERE 
  key_id = '8ad5c850c74e54803d5971f0b52f4a60e088a32b2a98187a94388f7e874a1a7a' 
  AND (
    token = '7sVkJMi+9YsvZAAwt38qPjMH65tWSeOhHt95frnw2CE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039