UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p0Yw8av9rw0coJJApETwvBpDTGhFciNBOWXuRMY56mg=' 
WHERE 
  key_id = 'db59de00e6e32b0db8b0419507c82818798835b7eb8521ab2854896dc967951b' 
  AND (
    token = 'p0Yw8av9rw0coJJApETwvBpDTGhFciNBOWXuRMY56mg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050