UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sh9tyGdzn32cQ2sdf17jZGxGeaAL5BdHoHluxximu50=' 
WHERE 
  key_id = '0328b0c0cb593e657b1359c57f123a6461f0b16260a04fa4fbb46f39821b02c2' 
  AND (
    token = 'sh9tyGdzn32cQ2sdf17jZGxGeaAL5BdHoHluxximu50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026