UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3UH1+b0EMAVq4Lf9bPbB1Yxpl7HnVv9BESto+W6rfMA=' 
WHERE 
  key_id = '44f8bfcf806d88a5307abedcb7650800122452e69093256de0b7437079e9ae3a' 
  AND (
    token = '3UH1+b0EMAVq4Lf9bPbB1Yxpl7HnVv9BESto+W6rfMA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033