UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0gmF+eNEGjleBe0HTDQmlb+YpmyqOATOucm5m0W3CEk=' 
WHERE 
  key_id = 'db4566d5ddb9b2975b582293367c5026822d73e94bc33bf1c205ffa3fc86c234' 
  AND (
    token = '0gmF+eNEGjleBe0HTDQmlb+YpmyqOATOucm5m0W3CEk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028