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

Query time 0.00031