UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4SIj9cHxSJXxDjhKo29dGSNxtPVilyicFrDPnl+kWlc=' 
WHERE 
  key_id = '34322e237a89a227ed709b73f04b10a66c1c2eb132d91916fb38e9d70dfcf471' 
  AND (
    token = '4SIj9cHxSJXxDjhKo29dGSNxtPVilyicFrDPnl+kWlc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059