UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dln1PCTbR+jShOXXV0/8mA0fIOQ3pdjCpm/55LZ6ER0=' 
WHERE 
  key_id = 'b1d6154b790c52892122480b7fbb25b5ef64282705e11b37e25ac9b99eac5c9b' 
  AND (
    token = 'Dln1PCTbR+jShOXXV0/8mA0fIOQ3pdjCpm/55LZ6ER0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033