UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '402OHbRIqpcoHYihro9bk7zDnDA2IOXcQiyKopiuHEw=' 
WHERE 
  key_id = '7d728c8f64f4ec4943d25523821d1ba5706a155740a57af9ac4af27f36b9744f' 
  AND (
    token = '402OHbRIqpcoHYihro9bk7zDnDA2IOXcQiyKopiuHEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038