UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tGb49vt5CJoFE2rDOy05g7sKmvMTTyvX39C7HmEvmOQ=' 
WHERE 
  key_id = '6e772281269496578917ef622a287452fe82232b2a0eec4412604e8705e50ec0' 
  AND (
    token = 'tGb49vt5CJoFE2rDOy05g7sKmvMTTyvX39C7HmEvmOQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052