UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z3vmHRIZw8Ko2Evy+8MUKJrROhI7djZszt2b+yRHcm0=' 
WHERE 
  key_id = '1469082d5177d4fe70d59f4cdc78d3a5ad66de24f55c88b9a076e1addaaa52d0' 
  AND (
    token = 'z3vmHRIZw8Ko2Evy+8MUKJrROhI7djZszt2b+yRHcm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020