UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gtBFjZhr62qU6datIov7cUsU1+FLXVeDUJ5uaKIc62Q=' 
WHERE 
  key_id = '0ac8600e84f7d9b671c4ba9b7421a74495ecfb77a77536063124571ba2e0b240' 
  AND (
    token = 'gtBFjZhr62qU6datIov7cUsU1+FLXVeDUJ5uaKIc62Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035