UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7ysaIZgGGxSggv8SF+e/BbWxb4eCAr2ri1M8AoEvRdU=' 
WHERE 
  key_id = '9e249d7d3fc3ba01e6bdc1967452fb332ae5e22890b0d831cac26a86d37ec65a' 
  AND (
    token = '7ysaIZgGGxSggv8SF+e/BbWxb4eCAr2ri1M8AoEvRdU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017