UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tKgUIxv4F0OFgDwrOvb5LTB4ODz2qxl5GO/WxQ/bjFc=' 
WHERE 
  key_id = 'b3390967767c8182f6bacde9b7ab492605a9cd4c9656327ea43663e861452762' 
  AND (
    token = 'tKgUIxv4F0OFgDwrOvb5LTB4ODz2qxl5GO/WxQ/bjFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033