UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j82WLCNX3HJGciSG53TzDFwaeazMq3OzsQadIxGXwJM=' 
WHERE 
  key_id = '803855e099d07fec2d5b90cee3095bc50c02c81a32e02794af07715101874ab2' 
  AND (
    token = 'j82WLCNX3HJGciSG53TzDFwaeazMq3OzsQadIxGXwJM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036