UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NOLKQ1YGWmHWW6BfGy2c1RyP472M/um32HQS7ktm0QM=' 
WHERE 
  key_id = '77357b5b2ac707400613b6414824efc5437130aa8a91f27dfd11a9dc9601c9e4' 
  AND (
    token = 'NOLKQ1YGWmHWW6BfGy2c1RyP472M/um32HQS7ktm0QM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033