UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+fRV0tu+w41rGKKIprciXzjw95ufizC6JtHauTfHVxI=' 
WHERE 
  key_id = '39d1447d29b9fbec53577798ff1e5dd7dbe3e3647ca5f9a49797342ad4555525' 
  AND (
    token = '+fRV0tu+w41rGKKIprciXzjw95ufizC6JtHauTfHVxI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030