UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YGviYmkv0B+WTX4fV2xBvPPIOj+ClQMTmDxLLU6Ck9Q=' 
WHERE 
  key_id = 'e349ae146edb3817073a23200af2d3ac5ef6e81a0bf8760325d135f0ab7348b2' 
  AND (
    token = 'YGviYmkv0B+WTX4fV2xBvPPIOj+ClQMTmDxLLU6Ck9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035