UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7C+3qWR3IxPWQuNm23JfJOfcyrJ9zcibW9fsLOPeXhk=' 
WHERE 
  key_id = '45af38f76911a32eb06a80237581af7530e7a711ae3f71c95ab2998e3abe564b' 
  AND (
    token = '7C+3qWR3IxPWQuNm23JfJOfcyrJ9zcibW9fsLOPeXhk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043