UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TPkldAmLK0vvBA68zlKt4lc9i1I+DwT0aAqLAnYlrc8=' 
WHERE 
  key_id = '0097ad98a3eb57f60c0a558867915b812f651b81f72c3c0c3337e96f2e2c107e' 
  AND (
    token = 'TPkldAmLK0vvBA68zlKt4lc9i1I+DwT0aAqLAnYlrc8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022