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

Query time 0.00027