UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'km8jS2YPnX4u27ChvpB1fQ2koDZsvx55qzc/rVEYnHk=' 
WHERE 
  key_id = 'ef3c0322380f4ec2d74aa90be53281765baffb25c80798a8d6309e9ddf6ff6d8' 
  AND (
    token = 'km8jS2YPnX4u27ChvpB1fQ2koDZsvx55qzc/rVEYnHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034