UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qbUKq8/Y38ipWSzQi0PAUYJ0VZOkWxRzOGD7yzy0R4s=' 
WHERE 
  key_id = '33c4c30712cc88e205d3613b963d58e7f37af31db425691248de91d06db87648' 
  AND (
    token = 'qbUKq8/Y38ipWSzQi0PAUYJ0VZOkWxRzOGD7yzy0R4s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031