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

Query time 0.00038