UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q3D4Zp8YRtqrsZHgJNAplzhuyAi92rgq3c7ObMIh3qw=' 
WHERE 
  key_id = '61a78767738b9c9279d04c5b5dcafd55f182a447880a4ad43f349d2dfb1d0900' 
  AND (
    token = 'q3D4Zp8YRtqrsZHgJNAplzhuyAi92rgq3c7ObMIh3qw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038