UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZJgN5moHCCvCJngNhAJ0GV4CMtEei/8dYPHjnznT2z4=' 
WHERE 
  key_id = '7db0791ee1314330149325fc7af16b5ac262845c450e5f570308b6bbb18f3cf9' 
  AND (
    token = 'ZJgN5moHCCvCJngNhAJ0GV4CMtEei/8dYPHjnznT2z4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033