UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bLfamBvz/156lzA23iM2ps9But9gS/1SsXyvq7pMteA=' 
WHERE 
  key_id = 'd482b83fa9db9e9ed47f2f0b6d119af3f5cad51a01b8108b4960a1bc252e46f8' 
  AND (
    token = 'bLfamBvz/156lzA23iM2ps9But9gS/1SsXyvq7pMteA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037