UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M0Hno2aMAs9Jl2aT0sHVrl6Bqo8uknWl8KlOHWmSvPE=' 
WHERE 
  key_id = '893c1e6fa85359c7ff949b5381a5d1ac5eed0068d3786525fb02b1b1ed875347' 
  AND (
    token = 'M0Hno2aMAs9Jl2aT0sHVrl6Bqo8uknWl8KlOHWmSvPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027