UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KmWv21yPOipPdQa77I9koRABhPOlM/0KaQhbVH6y48Y=' 
WHERE 
  key_id = '146c9f194843c06a62b7b5841f0858fdd063b0058ac07b5ee8600bdb3cfc4ef8' 
  AND (
    token = 'KmWv21yPOipPdQa77I9koRABhPOlM/0KaQhbVH6y48Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031