UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0PEvYQWZ3tGPi0xIT2zzkNfIUcy8zNAYJZKvsMsyQCc=' 
WHERE 
  key_id = 'ce807e267f879fe84319d0346ddf6037e59dc383d3e1788d0586c2c761891064' 
  AND (
    token = '0PEvYQWZ3tGPi0xIT2zzkNfIUcy8zNAYJZKvsMsyQCc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039